// 商品分类
<template>
  <div>
    <Row class="page">
      <Col span="24" gutter="10">
      <Col span="6" style="">
      <Card :bordered="true" style="padding-bottom:30px;">
        <p slot="title">手机号查询</p>
        <Col span="20" style="padding-right:10px;">
        <Input v-model="userTel" placeholder="手机号"></Input>
        </Col>
        <Col span="4">
        <Button type="primary" long @click.stop="chaxuen">查询</Button>
        </Col>
      </Card>
      </Col>
      <Col span="6" style="padding-left:10px;">
      <Card :bordered="true" style="padding-bottom:30px;">
        <p slot="title">会员人数</p>
        <Col span="24" style="padding-right:10px;">
        <h1>{{vipNumber}}</h1>
        </Col>

      </Card>
      </Col>
      </Col>
    </Row>
    <br>
    <Row>
      <Col span="24">
      <Row>
        <Col span="24">
        <Table border :columns="columns7" :data="data6"></Table>
        </Col>
      </Row>
      <br>
      <Row>
        <Page :total="100" @on-change="page" />
      </Row>
      </Col>
    </Row>
    <!-- <Modal v-model="modal2" title="订单详情">
      <Form ref="orderInfo" :model="orderInfo" :label-width="110">

        <FormItem label="订单号 :" prop="name">

          <p>s</p>

        </FormItem>
        <FormItem label="订单时间 :" prop="name">

          <p>s</p>

        </FormItem>
        <FormItem label="配送方式 :" prop="name">

        </FormItem>
        <FormItem label="用户留言 :" prop="name">

        </FormItem>
        <FormItem label="商品信息 :" prop="name">
          <div>
            <p>Content of no border type. Content of no border type.</p>
            <Row>
              <Col span="8">
              <p>数量:</p>
              </Col>
              <Col span="8">
              <p>单价:</p>
              </Col>
              <Col span="8">
              <p>合计:</p>
              </Col>
            </Row>
          </div>
        </FormItem>
        <FormItem label="订单金额:">
          <p>asdf</p>
        </FormItem>

      </Form>
      <div slot="footer">
        <Row>
          <Col span="18" offset="6">
          <Button type="info" @click="dy">打印订单</Button>
          <Button type="success">确认</Button>
          <Button type="warning">确认发货</Button>
          <Button type="error" @click="ok">取消</Button>
          </Col>

        </Row>
      </div>
    </Modal> -->
  </div>
</template>

<script type="text/ecmascript-6">
export default {
  data() {
    return {
      userTel: "",
      order: "0",
      orderInfo: {},
      modal1: false,
      modal2: false,
      columns7: [
        {
          title: "会员ID",
          key: "id",
          width: 100
        },
        {
          title: "用户昵称",
          key: "flmc",
          render: (h, params) => {
            return h("div", [h("strong", params.row.nickname)]);
          }
        },
        {
          title: "用户电话",
          key: "tel",
          sortable: true
        },
        {
          title: "注册时间",
          key: "create_datetime",
          sortable: true
        },
        {
          title: "性别",
          key: "sex",
          sortable: true,
          render: (h, params) => {
            if (params.row.sex == 1) {
              return "男";
            }
            if (params.row.sex == 2) {
              return "女";
            } else {
              return "未知";
            }
          }
        },
        {
          title: "微信头像",
          key: "header_img",
          sortable: true,
          width: 120,
          align: "center",
          render: (h, params) => {
            return h("div", [
              h("img", {
                style: {
                  width: "60px",
                  height: "60px"
                },
                attrs: {
                  src: params.row.header_img
                }
              })
            ]);
          }
        },
        {
          title: "操作",
          key: "caozuo",
          width: 200,
          align: "center",
          render: (h, params) => {
            return h("div", [
              h(
                "Button",
                {
                  props: {
                    type: "error",
                    size: "small"
                  },
                  on: {
                    click: () => {
                      this.remove(params.index);
                    }
                  }
                },
                "删除"
              )
            ]);
          }
        }
      ],
      data6: [
        {
          name: "John Brown",
          spsl: 18,
          number: 22
        }
      ],
      value: "",
      vipNumber:""
    };
  },
  created() {
    this.getNumber(1);
    this.getVipNumber();
  },
  methods: {
        getVipNumber: function() {
      let _self = this;
      $.ajax({
        url: BASE_URL + "membermanagement/memberCount",
        type: "get",
        success: function(e) {
          _self.vipNumber = e;
        }.bind(this)
      });
    },
    page(e){
this.getNumber(e)
    },
    chaxuen() {
      let _self = this;
      if (_self.userTel) {
        $.ajax({
          url: BASE_URL + "membermanagement",
          type: "get",
          data: {
            pageNumber: 1,
            pageSize: 1,
            tel: _self.userTel
          },
          success: function(e) {
            _self.data6 = e.list;
          }.bind(this)
        });
      }else{
        _self.getNumber(1)
      }
    },
    getNumber: function(number) {
      let _self = this;
      $.ajax({
        url: BASE_URL + "membermanagement",
        type: "get",
        data: {
          pageNumber: number,
          pageSize: 10,
          tel: ""
        },
        success: function(e) {
          console.log(e);
          _self.data6 = e.list;
        }.bind(this)
      });
    },
    dy() {
      window.print();
    },
    ss(e) {
      console.log(e);
    },
    handleAdd() {
      this.index++;
      this.formDynamic.items.push({
        value: "",
        index: this.index,
        status: 1
      });
    },
    ok() {
      // console.log(this.formValidate, this.formDynamic, this.list);
      this.modal2 = false;
      //   this.$Message.info("Clicked ok");
      //   this.data6.push({ name: this.value, spsl: "0" });
    },
    cancel() {
      this.$Message.info("Clicked cancel");
    },
    remove(index) {
      this.data6.splice(index, 1);
    },
    handleSubmit(name) {
      console.log(name);
      this.$refs[name].validate(valid => {
        if (valid) {
          this.$Message.success("Success!");
        } else {
          this.$Message.error("Fail!");
        }
      });
    },
    handleReset(name) {
      this.$refs[name].resetFields();
    }
  }
};
</script>

<style scoped>
</style>
